﻿<%@ Page EnableEventValidation="False" Title="Search for Customer" Language="C#" MasterPageFile="~/Pages/user/userMaster.Master" AutoEventWireup="true" CodeBehind="SearchCustomer.aspx.cs" Inherits="WarehouseWebAPP.Pages.user.Search_Pages.SearchCustomer" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style22
        {
        }
        .style23
        {
            width: 90px;
        }
        .style24
        {
            width: 100%;
            position: relative;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="style24">
    <tr>
        <td class="style23">
            <asp:Label ID="Label7" runat="server" Text="ID"></asp:Label>
        </td>
        <td class="style22">
                 <cc1:ComboBox ID="IDComboBox" runat="server" AppendDataBoundItems="True" 
                     AutoCompleteMode="Append" DataSourceID="IDObjectDataSource" 
                     DataTextField="customer_id" DataValueField="customer_id" MaxLength="0" 
                     ondatabound="IDComboBox_DataBound">
                 </cc1:ComboBox>
        </td>
        <td class="style22">
            <asp:Label ID="Label4" runat="server" Text="E-Mail"></asp:Label>
        </td>
        <td class="style22">
            <asp:TextBox ID="EmailTextBox" runat="server"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="style23">
            <asp:Label ID="Label3" runat="server" Text="Name"></asp:Label>
        </td>
        <td class="style22">
            <cc1:ComboBox ID="NameComboBox" runat="server" AppendDataBoundItems="True" 
                AutoCompleteMode="Append" DataSourceID="NameObjectDataSource" 
                DataTextField="customer_name" DataValueField="customer_name" MaxLength="0" 
                ondatabound="NameComboBox_DataBound">
            </cc1:ComboBox>
        </td>
        <td class="style22">
            <asp:Label ID="Label8" runat="server" Text="Type"></asp:Label>
        </td>
        <td class="style22">
            <asp:DropDownList ID="TypeDropDownList" runat="server" 
                DataSourceID="TypeObjectDataSource" DataTextField="customer_type" 
                DataValueField="customer_type_num" ondatabound="TypeDropDownList_DataBound">
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td class="style23">
            <asp:Label ID="Label6" runat="server" Text="Address"></asp:Label>
        </td>
        <td class="style22" colspan="3">
            <asp:TextBox ID="AdressTextBox" runat="server"></asp:TextBox>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </td>
    </tr>
    <tr>
        <td colspan="3" bgcolor="#E3E6EA">
            &nbsp;</td>
        <td bgcolor="#E3E6EA">
            <asp:Button ID="Button1" runat="server" BackColor="#FFFBFF" 
 BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px"  
 Font-Names="Verdana" Font-Size="Small" ForeColor="#284775" Text="Search" Width="76px" 
                onclick="Button1_Click1"/>
        </td>
    </tr>
</table>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:GridView ID="CustomerGridView" runat="server" Width="656px" AllowPaging="True" 
        AutoGenerateColumns="False" DataKeyNames="customer_num" 
        DataSourceID="ObjectDataSource" CellPadding="4" ForeColor="#333333" 
        GridLines="None" AllowSorting="True" 
        ondatabound="CustomerGridView_DataBound" style="margin-right: 3px">
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <Columns>
                    <asp:BoundField DataField="customer_num" 
                HeaderText="customer_num" SortExpression="customer_num" 
            ReadOnly="True" Visible="False" />
                    <asp:BoundField DataField="customer_id" HeaderText="ID" 
                SortExpression="customer_id" />
                    <asp:BoundField DataField="customer_name" HeaderText="Name" 
            SortExpression="customer_name" />
                    <asp:TemplateField HeaderText="Type" SortExpression="customer_type">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("customer_type") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="TypeLabel" runat="server" Text='<%# Bind("customer_type") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="customer_address" HeaderText="Address" 
            SortExpression="customer_address" />
                    <asp:BoundField DataField="customer_phone" HeaderText="Phone No." 
            SortExpression="customer_phone" />
                    <asp:BoundField DataField="customer_email" HeaderText="E-Mail" 
            SortExpression="customer_email" />
                </Columns>
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#999999" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            </asp:GridView>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
    <asp:LinkButton ID="ExcelButton" runat="server" onclick="ExcelButton_Click">Export 
    to Excel</asp:LinkButton>
<asp:ObjectDataSource ID="ObjectDataSource" runat="server" 
        SelectMethod="CustomerSearch" 
        TypeName="WarehouseWebAPP.code.BLL.CustomerBLL" 
    DeleteMethod="CustomerDelete" InsertMethod="CustomerInsert" 
    UpdateMethod="CustomerUpdate" OldValuesParameterFormatString="original_{0}" 
        DataObjectTypeName="System.Guid">
    <UpdateParameters>
        <asp:Parameter Name="customer_id" Type="String" />
        <asp:Parameter Name="customer_name" Type="String" />
        <asp:Parameter DbType="Guid" Name="customer_type" />
        <asp:Parameter Name="customer_address" Type="String" />
        <asp:Parameter Name="customer_phone" Type="String" />
        <asp:Parameter Name="customer_email" Type="String" />
        <asp:Parameter DbType="Guid" Name="customer_num" />
    </UpdateParameters>
    <SelectParameters>
        <asp:ControlParameter ControlID="IDComboBox" DefaultValue="%" Name="customer_id" 
            PropertyName="SelectedValue" Type="String" />
        <asp:ControlParameter ControlID="NameComboBox" DefaultValue="%" 
            Name="customer_name" PropertyName="SelectedValue" Type="String" />
        <asp:ControlParameter ControlID="AdressTextBox" DefaultValue="%" 
            Name="customer_address" PropertyName="Text" Type="String" />
        <asp:ControlParameter ControlID="EmailTextBox" DefaultValue="%" 
            Name="customer_email" PropertyName="Text" Type="String" />
        <asp:ControlParameter ControlID="TypeDropDownList" DefaultValue="%" 
            Name="customer_type" PropertyName="SelectedValue" Type="String" />
    </SelectParameters>
    <InsertParameters>
        <asp:Parameter Name="customer_id" Type="String" />
        <asp:Parameter Name="customer_name" Type="String" />
        <asp:Parameter Name="customer_type" Type="String" />
        <asp:Parameter Name="customer_address" Type="String" />
        <asp:Parameter Name="customer_phone" Type="String" />
        <asp:Parameter Name="customer_email" Type="String" />
    </InsertParameters>
</asp:ObjectDataSource>
    <asp:ObjectDataSource ID="IDObjectDataSource" runat="server" 
        SelectMethod="CustomerGet" TypeName="WarehouseWebAPP.code.BLL.CustomerBLL">
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="NameObjectDataSource" runat="server" 
        SelectMethod="CustomerGet" TypeName="WarehouseWebAPP.code.BLL.CustomerBLL">
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="TypeObjectDataSource" runat="server" 
        SelectMethod="CustomerTypeGet" 
        TypeName="WarehouseWebAPP.code.BLL.CustomerTypeBLL"></asp:ObjectDataSource>
<br />
</asp:Content>
